home *** CD-ROM | disk | FTP | other *** search
/ Amiga Tools 5 / Amiga Tools 5.iso / tools / developer-tools / aros / source / exec / semaphores / src / addsemaphore.c < prev    next >
Encoding:
C/C++ Source or Header  |  1996-07-16  |  1.3 KB  |  66 lines

  1. /*
  2.     (C) 1995, 96 AROS - The Amiga Replacement OS
  3.     $Id$
  4.     $Log$
  5.     Desc:
  6.     Lang: english
  7. */
  8. #include "exec_intern.h"
  9.  
  10. /*****************************************************************************
  11.  
  12.     NAME */
  13.     #include <exec/semaphores.h>
  14.     #include <clib/exec_protos.h>
  15.  
  16.     __AROS_LH1(void, AddSemaphore,
  17.  
  18. /*  SYNOPSIS */
  19.     __AROS_LA(struct SignalSemaphore *, sigSem, A1),
  20.  
  21. /*  LOCATION */
  22.     struct ExecBase *, SysBase, 100, Exec)
  23.  
  24. /*  FUNCTION
  25.     Adds a semaphore to the system public semaphore list. Since the
  26.     semaphore gets initialized by this function it must be free at
  27.     this time. Also the ln_Name field must be set.
  28.  
  29.     INPUTS
  30.     sigSem - Pointer to semaphore structure
  31.  
  32.     RESULT
  33.  
  34.     NOTES
  35.     Semaphores are shared between the tasks that use them and must
  36.     therefore lie in public (or at least shared) memory.
  37.  
  38.     EXAMPLE
  39.  
  40.     BUGS
  41.  
  42.     SEE ALSO
  43.  
  44.     INTERNALS
  45.  
  46.     HISTORY
  47.  
  48. *****************************************************************************/
  49. {
  50.     __AROS_FUNC_INIT
  51.  
  52.     /* Intialize semaphore */
  53.     sigSem->ss_Link.ln_Type=NT_SIGNALSEM;
  54.     InitSemaphore(sigSem);
  55.  
  56.     /* Arbitrate for the semaphore list */
  57.     Forbid();
  58.     /* Add the semaphore */
  59.     Enqueue(&SysBase->SemaphoreList,&sigSem->ss_Link);
  60.  
  61.     /* All done. */
  62.     Permit();
  63.     __AROS_FUNC_EXIT
  64. } /* AddSemaphore */
  65.  
  66.